﻿#if USE_UNI_LUA
using LuaAPI = UniLua.Lua;
using RealStatePtr = UniLua.ILuaState;
using LuaCSFunction = UniLua.CSharpFunctionDelegate;
#else
using LuaAPI = XLua.LuaDLL.Lua;
using RealStatePtr = System.IntPtr;
using LuaCSFunction = XLua.LuaDLL.lua_CSFunction;
#endif

using XLua;
using System.Collections.Generic;


namespace XLua.CSObjectWrap
{
    using Utils = XLua.Utils;
    public class UnityJobsJobHandleWrap 
    {
        public static void __Register(RealStatePtr L)
        {
			ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			System.Type type = typeof(Unity.Jobs.JobHandle);
			Utils.BeginObjectRegister(type, L, translator, 0, 1, 1, 0);
			
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "Complete", _m_Complete);
			
			
			Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsCompleted", _g_get_IsCompleted);
            
			
			
			Utils.EndObjectRegister(type, L, translator, null, null,
			    null, null, null);

		    Utils.BeginClassRegister(type, L, __CreateInstance, 5, 0, 0);
			Utils.RegisterFunc(L, Utils.CLS_IDX, "CompleteAll", _m_CompleteAll_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "ScheduleBatchedJobs", _m_ScheduleBatchedJobs_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "CombineDependencies", _m_CombineDependencies_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "CheckFenceIsDependencyOrDidSyncFence", _m_CheckFenceIsDependencyOrDidSyncFence_xlua_st_);
            
			
            
			
			
			
			Utils.EndClassRegister(type, L, translator);
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int __CreateInstance(RealStatePtr L)
        {
            
			try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
				
				if (LuaAPI.lua_gettop(L) == 1)
				{
				    translator.Push(L, default(Unity.Jobs.JobHandle));
			        return 1;
				}
				
			}
			catch(System.Exception gen_e) {
				return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
			}
            return LuaAPI.luaL_error(L, "invalid arguments to Unity.Jobs.JobHandle constructor!");
            
        }
        
		
        
		
        
        
        
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_Complete(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                Unity.Jobs.JobHandle gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
            
            
                
                {
                    
                    gen_to_be_invoked.Complete(  );
                    
                    
                        translator.Update(L, 1, gen_to_be_invoked);
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_CompleteAll_xlua_st_(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
            
			    int gen_param_count = LuaAPI.lua_gettop(L);
            
                if(gen_param_count == 1&& translator.Assignable<Unity.Collections.NativeArray<Unity.Jobs.JobHandle>>(L, 1)) 
                {
                    Unity.Collections.NativeArray<Unity.Jobs.JobHandle> _jobs;translator.Get(L, 1, out _jobs);
                    
                    Unity.Jobs.JobHandle.CompleteAll( _jobs );
                    
                    
                    
                    return 0;
                }
                if(gen_param_count == 2&& translator.Assignable<Unity.Jobs.JobHandle>(L, 1)&& translator.Assignable<Unity.Jobs.JobHandle>(L, 2)) 
                {
                    Unity.Jobs.JobHandle _job0;translator.Get(L, 1, out _job0);
                    Unity.Jobs.JobHandle _job1;translator.Get(L, 2, out _job1);
                    
                    Unity.Jobs.JobHandle.CompleteAll( ref _job0, ref _job1 );
                    translator.Push(L, _job0);
                        translator.Update(L, 1, _job0);
                        
                    translator.Push(L, _job1);
                        translator.Update(L, 2, _job1);
                        
                    
                    
                    
                    return 2;
                }
                if(gen_param_count == 3&& translator.Assignable<Unity.Jobs.JobHandle>(L, 1)&& translator.Assignable<Unity.Jobs.JobHandle>(L, 2)&& translator.Assignable<Unity.Jobs.JobHandle>(L, 3)) 
                {
                    Unity.Jobs.JobHandle _job0;translator.Get(L, 1, out _job0);
                    Unity.Jobs.JobHandle _job1;translator.Get(L, 2, out _job1);
                    Unity.Jobs.JobHandle _job2;translator.Get(L, 3, out _job2);
                    
                    Unity.Jobs.JobHandle.CompleteAll( ref _job0, ref _job1, ref _job2 );
                    translator.Push(L, _job0);
                        translator.Update(L, 1, _job0);
                        
                    translator.Push(L, _job1);
                        translator.Update(L, 2, _job1);
                        
                    translator.Push(L, _job2);
                        translator.Update(L, 3, _job2);
                        
                    
                    
                    
                    return 3;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            
            return LuaAPI.luaL_error(L, "invalid arguments to Unity.Jobs.JobHandle.CompleteAll!");
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_ScheduleBatchedJobs_xlua_st_(RealStatePtr L)
        {
		    try {
            
            
            
                
                {
                    
                    Unity.Jobs.JobHandle.ScheduleBatchedJobs(  );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_CombineDependencies_xlua_st_(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
            
			    int gen_param_count = LuaAPI.lua_gettop(L);
            
                if(gen_param_count == 1&& translator.Assignable<Unity.Collections.NativeArray<Unity.Jobs.JobHandle>>(L, 1)) 
                {
                    Unity.Collections.NativeArray<Unity.Jobs.JobHandle> _jobs;translator.Get(L, 1, out _jobs);
                    
                        var gen_ret = Unity.Jobs.JobHandle.CombineDependencies( _jobs );
                        translator.Push(L, gen_ret);
                    
                    
                    
                    return 1;
                }
                if(gen_param_count == 1&& translator.Assignable<Unity.Collections.NativeSlice<Unity.Jobs.JobHandle>>(L, 1)) 
                {
                    Unity.Collections.NativeSlice<Unity.Jobs.JobHandle> _jobs;translator.Get(L, 1, out _jobs);
                    
                        var gen_ret = Unity.Jobs.JobHandle.CombineDependencies( _jobs );
                        translator.Push(L, gen_ret);
                    
                    
                    
                    return 1;
                }
                if(gen_param_count == 2&& translator.Assignable<Unity.Jobs.JobHandle>(L, 1)&& translator.Assignable<Unity.Jobs.JobHandle>(L, 2)) 
                {
                    Unity.Jobs.JobHandle _job0;translator.Get(L, 1, out _job0);
                    Unity.Jobs.JobHandle _job1;translator.Get(L, 2, out _job1);
                    
                        var gen_ret = Unity.Jobs.JobHandle.CombineDependencies( _job0, _job1 );
                        translator.Push(L, gen_ret);
                    
                    
                    
                    return 1;
                }
                if(gen_param_count == 3&& translator.Assignable<Unity.Jobs.JobHandle>(L, 1)&& translator.Assignable<Unity.Jobs.JobHandle>(L, 2)&& translator.Assignable<Unity.Jobs.JobHandle>(L, 3)) 
                {
                    Unity.Jobs.JobHandle _job0;translator.Get(L, 1, out _job0);
                    Unity.Jobs.JobHandle _job1;translator.Get(L, 2, out _job1);
                    Unity.Jobs.JobHandle _job2;translator.Get(L, 3, out _job2);
                    
                        var gen_ret = Unity.Jobs.JobHandle.CombineDependencies( _job0, _job1, _job2 );
                        translator.Push(L, gen_ret);
                    
                    
                    
                    return 1;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            
            return LuaAPI.luaL_error(L, "invalid arguments to Unity.Jobs.JobHandle.CombineDependencies!");
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_CheckFenceIsDependencyOrDidSyncFence_xlua_st_(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
            
                
                {
                    Unity.Jobs.JobHandle _jobHandle;translator.Get(L, 1, out _jobHandle);
                    Unity.Jobs.JobHandle _dependsOn;translator.Get(L, 2, out _dependsOn);
                    
                        var gen_ret = Unity.Jobs.JobHandle.CheckFenceIsDependencyOrDidSyncFence( _jobHandle, _dependsOn );
                        LuaAPI.lua_pushboolean(L, gen_ret);
                    
                    
                    
                    return 1;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            
        }
        
        
        
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _g_get_IsCompleted(RealStatePtr L)
        {
		    try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			
                Unity.Jobs.JobHandle gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
                LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsCompleted);
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            return 1;
        }
        
        
        
		
		
		
		
    }
}
